package com.inspur.dgov.bsp.user.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.inspur.dgov.bsp.user.entity.PubOrganRelation;
import com.inspur.dgov.bsp.user.mapper.PubOrganRelationMapper;
import com.inspur.dgov.bsp.user.service.PubOrganRelationService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 组织关系 服务实现类
 *
 * @author chiyupei
 * @version 1.0
 * @since 1.0
 */
@Slf4j
@Service
@AllArgsConstructor
public class PubOrganRelationServiceImpl extends ServiceImpl<PubOrganRelationMapper, PubOrganRelation> implements PubOrganRelationService {

    /**
     * 递归添加组织机构系
     * @param relation
     * @return
     */
    public boolean insertRecursionOrganRelation(PubOrganRelation relation) {
        return baseMapper.insertRecursionOrganRelation(relation);
    }

    /**
     * 分离子树,删除子树节点与其祖先的关系
     * @param relation
     */
    @Override
    public boolean separateOrganRelation(PubOrganRelation relation) {
        return baseMapper.separateOrganRelation(relation);
    }

    /**
     * 移动子树，用笛卡尔积嫁接
     * @param relation
     */
    @Override
    public boolean moveOrganRelation(PubOrganRelation relation) {
        return baseMapper.moveOrganRelation(relation);
    }
}
